package xpn.platform.modules.todo.wsdl;

public class TodosProxy implements Todos {
  private String _endpoint = null;
  private Todos todos = null;
  
  public TodosProxy() {
    _initTodosProxy();
  }
  
  public TodosProxy(String endpoint) {
    _endpoint = endpoint;
    _initTodosProxy();
  }
  
  private void _initTodosProxy() {
    try {
      todos = (new TodosServiceLocator()).getDomino();
      if (todos != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)todos)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)todos)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (todos != null)
      ((javax.xml.rpc.Stub)todos)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public Todos getTodos() {
    if (todos == null)
      _initTodosProxy();
    return todos;
  }
  
  public String login(String username, String password) throws java.rmi.RemoteException{
    if (todos == null)
      _initTodosProxy();
    return todos.login(username, password);
  }
  
  public boolean create(String token, String url, String senderId, String senderName, String subject, String category, String emergency, String sendee) throws java.rmi.RemoteException{
    if (todos == null)
      _initTodosProxy();
    return todos.create(token, url, senderId, senderName, subject, category, emergency, sendee);
  }
  
  public boolean delete(String token, String url, String sendee) throws java.rmi.RemoteException{
    if (todos == null)
      _initTodosProxy();
    return todos.delete(token, url, sendee);
  }
  
  public boolean complete(String token, String url, String userId) throws java.rmi.RemoteException{
    if (todos == null)
      _initTodosProxy();
    return todos.complete(token, url, userId);
  }
  
  
}